# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年12月23日
"""
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
from matplotlib import pyplot as plt

x, y = make_blobs(n_samples=500, n_features=2, centers=3)
y_pred = KMeans(n_clusters=4, random_state=9).fit_predict(x)
plt.scatter(x[:, 0], x[:, 1], c=y_pred)
plt.show()
